home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
programming
/
source
/
retinasource.lha
/
RBO_SCode.lha
/
Include
/
mouse.s
< prev
next >
Wrap
Text File
|
1993-05-03
|
1KB
|
50 lines
ReadMouse:
clr.w d0
move.b Joy0Dat+Custom,d0 joy0dat
move.w OldY,d1
sub d0,d1
move.w d1,YP calculate diference between the
;last reading and the current reading
move.w d0,OldY store the current reading
cmp.w #128,YP is the diference greater that 128
;(129-255)
blt Mouse_Not_128
sub.w #256,YP make it 0 to 127
Mouse_Not_128:
cmp.w #-128,YP is the differnce between -128 and 0
bgt Mouse_Not_Minus
add.w #256,YP make it in the range 0 to 127
Mouse_Not_Minus:
move.w YP,d0
add.w d0,YP2 add on the difference to the mouse
;position
cmp.w #YMin,YP2 check if it goes out of range
bge.s YPos_Ok1
move.w #YMin,YP2 stop if going out of range
YPos_Ok1:
cmp.w #YMax,YP2 check if it goes out of range
blt.s YPos_Ok2
move.w #YMax,YP2 stop if going out of range
YPos_Ok2:
move.w #YMax,d0 invert the reading as mouse reader
sub.w YP2,d0 gives the reverse info
add.w #YMin,d0
move.w d0,YPos store in user var
rts
YPos: dc.w 0
OldY: dc.w 0
YP: dc.w 0
YP2: dc.w YMax
OldYP2: dc.w Ymin